package com.jeff.tianti.cms.dto.font;

import com.jeff.tianti.cms.entity.GateUser;

public class UserGateTo {
    private String uid;
    private String nickname;//昵称
    private String name;//姓名
    private String company;//公司名称
    private String email;//邮箱

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public static GateUser of(UserGateTo userGateTo, GateUser gateUser) {
        if (userGateTo == null) {
            return gateUser;
        }
        gateUser.setEmail(userGateTo.getEmail());
        gateUser.setUserName(userGateTo.getName());
        gateUser.setCompany(userGateTo.getCompany());
        gateUser.setNickName(userGateTo.getNickname());
        return gateUser;
    }

    public static UserGateTo of(GateUser gateUser) {
        UserGateTo userGateTo = new UserGateTo();
        if (gateUser == null) {
            return userGateTo;
        }
        userGateTo.setCompany(gateUser.getCompany() == null ? "" : gateUser.getCompany());
        userGateTo.setEmail(gateUser.getEmail() == null ? "" : gateUser.getEmail());
        userGateTo.setName(gateUser.getUserName() == null ? "" : gateUser.getUserName());
        userGateTo.setNickname(gateUser.getNickName() == null ? "" : gateUser.getNickName());
        userGateTo.setUid(gateUser.getId());
        return userGateTo;
    }
}
